/*
 * Copyright 2010-2012 Susanta Tewari. <freecode4susant@users.sourceforge.net>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.stat.model.data;

/**
 * A data holds both the read-in (observed) value and an estimated value.
 * read-in value has the common interface as string type and the estimated value is of
 * double as they are the most likely. Of course, subclasses convert these to their
 * requirements.
 * @author stewari1
 */
public abstract class Data implements Cloneable {

    /**
     * A common interface to read data. Different data values with different
     * storage types will process the String data differently. Some might store it or some
     * might parse it into a doble and store that.
     * @param val
     */
    public abstract void setValue(String val);

    /**
     * a convenience method
     * @throws UnsupportedOperationException for some subclasses
     * @return
     */
    public abstract double getValue();

    /**
     * a convenience method
     * @throws UnsupportedOperationException for some subclasses
     * @return
     */
    public abstract void setEstimatedValue(double val);

    /**
     * a convenience method
     * @throws UnsupportedOperationException for some subclasses
     * @return
     */
    public abstract double getEstimatedValue();

    /**
     * a convenience method
     * @throws UnsupportedOperationException for some subclasses
     * @return
     */
    public abstract void setEstimatedStrValue(String val);

    /**
     * a convenience method
     * @throws UnsupportedOperationException for some subclasses
     * @return
     */
    public abstract String getEstimatedStrValue();

    /**
     * Since this class will contain only primitives (double, int ..) or immutable object (string)
     * clonable interface will take care of cloning. No extra deep copy operation is needed.
     * This cloning feature is used in {@link org.stat.model.data.Record} to create an empty Record.
     * The value must be initialized to the default value.
     * @return
     */
    public abstract Data cloneDefaultInstance();
}
